/*
 * Copyright (C) 2010-2011 Graz University of Technology, Austria. All Rights reserved. 
 *
 * Contact: Simone Kopeinik <simone.kopeinik@tugraz.at>
 * 	   Graz University of Technology, Knowledge Management Institute, Brückenkopfgasse 1/6, 8020 Graz 	
 * 	   <http://www.kmi.tugraz.at/>
 * 
 * This software is part of the TARGET platform developed by the
 * TARGET EC-funded project www.reachyourtarget.org
 *
 * This software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * The GNU General Public License is available at <http://www.gnu.org/licenses/>.
 *
 */
package at.tugraz.kmi.css.cbkst2.prereq;

import org.apache.commons.collections15.Factory;

import com.google.inject.Inject;
import com.google.inject.Provider;

/**
 * Simple class to adapt a apache collections "Factory" to a google guice
 * "Provider" interface.
 * 
 * Both concepts mean exactly the same - so this is a very simple adapter.
 * 
 * @author Georg Oettll <georg.oettl@gmail.com>Öttl <georg.oettl@gmail.com>
 * 
 * @param <T>
 */
public final class FactoryAdapter<T> implements Factory<T> {

	private final Provider<T>	provider;

	/**
	 * Adapts the typed Provider to a typed Factory
	 * 
	 * @param provider
	 */
	@Inject
	public FactoryAdapter(Provider<T> provider) {
		this.provider = provider;
	}

	@Override
	public T create() {
		return this.provider.get();
	}

}
